import request from '@/utils/request'
import type { UserManagerCommon } from './types/userManageType'

// 获取用户列表
export type UserManageCondition = Partial<{
    currentPage: number,
    pageSize: number,
    phone: string,
    userId: string,
    startCreateTime: string,
    endCreateTime: string,
}>

export type UserManageResult = {
    current: number,
    hitCount?: boolean,
    optimizeCountSql?: boolean,
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    orders?: any[],
    pages: number,
    records: UserManageData[],
    searchCount?: boolean,
    size: number,
    total: number
}

type UserManageData = {
    accountNonExpired: boolean,
    accountNonLocked: boolean,
    createTime: string,
    credentialsNonExpired: boolean,
    id: number,
    isDel: boolean,
    name: string,
    password: string,
    phone: string,
    portrait: string | null,
    regId: string | null,
    status: 'ENABLE' | 'DISABLE' ,
    updateTime: string,
    
}



export function getUserManage(body: UserManageCondition = {}) {
    return request<UserManagerCommon<UserManageResult>>({
        url: '/boss/user/getUserPages',
        method: 'post',
        data: body
    })
}